package com.zhulin.android.edoctor.fragment;

import com.zhulin.android.edoctor.MainActivity;
import com.zhulin.android.edoctor.R;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;

public class FragmentLoginSelectList extends DialogFragment implements OnClickListener{

	private MainActivity mMainActivity;
	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);

		mMainActivity=(MainActivity) activity;
	}
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setStyle(DialogFragment.STYLE_NO_FRAME, android.R.style.Theme_Dialog);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view=inflater.inflate(R.layout.dialog_user_login_selectlist, container, false);

		view.findViewById(R.id.btnLogin).setOnClickListener(this);
		view.findViewById(R.id.btnCancel).setOnClickListener(this);
		view.findViewById(R.id.btnRegister).setOnClickListener(this);
		return view;
	}

	@Override
	public void onClick(View v) {
		switch(v.getId()){
		case R.id.btnLogin:{
			mMainActivity.addFragmentOfUserLogin();
			break;
		}case R.id.btnCancel:{
			dismiss();
			break;
		}case R.id.btnRegister:{
			mMainActivity.addFragmentOfRegister();
			break;
		}
		}
		dismiss();
	}
}
